import request from "@/utils/request.ts";
import type { CreateOrderMedicinePay, OrderPre } from "@/types/medicineTypes";
import type { ResponseType } from "@/types/responseTypes";
import { OrderDetail } from "@/types/medicineTypes";

enum Enum {
    medicineOrderPre = "/patient/medicine/order/pre",
    createMedicineOrder = "/patient/medicine/order",
    medicineOrderDetail = "/patient/medicine/order/detail"
}

/*获取药品预支付信息的接口*/
export const fetchMedicineOrderPreAPI = (prescriptionId: string): Promise<ResponseType<OrderPre>> => request.get<OrderPre, ResponseType<OrderPre>>(Enum.medicineOrderPre, { params: { prescriptionId } });
/*创建药品订单的接口*/
export const createMedicineOrderAPI = (data: CreateOrderMedicinePay): Promise<ResponseType<{ id: string }>> => request.post<{ id: string }, ResponseType<{ id: string }>>(Enum.createMedicineOrder, data);
/*获取药品订单详情的接口*/
export const fetchMedicineOrderDetailAPI = (id: string): Promise<ResponseType<OrderDetail>> => request.get<OrderDetail, ResponseType<OrderDetail>>(`${Enum.medicineOrderDetail}/${id}`);
